package com.loong.x;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * SpringBoot  启动器
 */
//包扫描，指定位置
//ComponentScan做的事情就是告诉Spring从哪里找到bean。包扫描会扫描只要标注了@Controller,@Service,@Repository,@Component这四个注解都会被扫描到容器中。
//@MapperScan({"com.hctel.oos.ncmount","com.hctel.oos.netconf","com.hctel.oos.ncmount.me"})
@MapperScan({"com.loong.x.app.mapper", "com.loong.x.app.dao"})
//@ComponentScan({"com.hctel.oos.ncmount", "com.hctel.oos.netconf", "com.hctel.oos.common", "com.hctel.oos.login"})
@SpringBootApplication
public class App {

    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(App.class, args);

        if (false) {
            String[] names = run.getBeanDefinitionNames();
            int i = 0;
            for (String name : names) {
                System.out.println(name);
                i++;
            }
            System.out.println("\n" + i + "\n");
        }
    }

    //此方法有效
//    @Bean
//    public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer(){
//        return factory -> {
//            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/index.html");
//            factory.addErrorPages(error404Page);
//        };
//    }

}
